home *** CD-ROM | disk | FTP | other *** search
/ Medabots Cardz / Medabots CD Cardz Sumilidon.bin / mac / assets / sumilidon.dxr / 00018_Script_18 < prev    next >
Text File  |  2001-12-07  |  3KB  |  119 lines

  1. property pSpeed, dx, dy, mysprite, counter, buttonover
  2. global showarea, discx, discy, area, smallmedal, portdy, portdx, goback, portnum, medaldown, amiwideopen, transitionz, onedown
  3.  
  4. on beginsprite me
  5.   set mysprite to the spritenum of me
  6.   set the blend of sprite mysprite = 100
  7.   set dx to the loch of sprite(mysprite)
  8.   set dy to the locv of sprite(mysprite)
  9.   counter = 1
  10. end
  11.  
  12. on mouseEnter me
  13.   if smallmedal = 0 then
  14.     showarea = 2
  15.     buttonover = 1
  16.     puppetsound ("hum2"), 2
  17.   end if
  18.   
  19. end
  20.  
  21. on mouseLeave me
  22.   if smallmedal = 0 then
  23.     showarea = 0
  24.     buttonover = 0
  25.     set the member of sprite mysprite = ("medal")
  26.     puppetsound 1,0
  27.   end if
  28. end
  29.  
  30.  
  31. on mouseDown me
  32.   medaldown = 2
  33. end
  34.  
  35. on mouseUp me
  36.   medaldown = 0
  37.   if smallmedal = 0 then
  38.     if sprite mysprite intersects sprite(portnum) then
  39.       onedown = 1
  40.       set the blend of sprite mysprite = 0
  41.       set the loch of sprite mysprite to dx
  42.       set the locv of sprite mysprite to dy
  43.       smallmedal = 1
  44.       area = 2
  45.       transitionz = "close"
  46.     else
  47.       set the loch of sprite mysprite to dx
  48.       set the locv of sprite mysprite to dy
  49.     end if
  50.   end if 
  51. end
  52.  
  53. on exitframe
  54.   if medaldown = 2 then
  55.     buttonover = 0
  56.   end if
  57.   
  58.   if area = 0 then
  59.     if amiwideopen = "yes" then
  60.       sprite(mysprite).moveablesprite = TRUE
  61.       end if
  62.     else
  63.       sprite(mysprite).moveablesprite = FALSE
  64.     end if
  65.     
  66.     if goback = 2 or goback = "2a" then
  67.       set the blend of sprite mysprite = 100
  68.       goback = 0
  69.     end if
  70.     
  71.     if buttonover = 1 then
  72.       if counter < 6 then
  73.         counter = counter + 1
  74.       end if
  75.       if counter = 2 then 
  76.         set the member of sprite mysprite = ("roll1")
  77.       else  if counter = 3 then 
  78.         set the member of sprite mysprite = ("roll2")
  79.       else  if counter = 4 then 
  80.         set the member of sprite mysprite = ("roll3")
  81.       else  if counter = 5 then 
  82.         set the member of sprite mysprite = ("roll4")
  83.       else  if counter = 6 then 
  84.         set the member of sprite mysprite = ("roll5")
  85.         counter = 1
  86.       end if
  87.     end if
  88.     
  89.     
  90.     
  91.     if sprite mysprite intersects sprite(portnum) then
  92.       --    set the width of sprite(mysprite) to 38
  93.       --    set the height of sprite(mysprite) to 40
  94.     else 
  95.       --    set the width of sprite(mysprite) to 66
  96.       --    set the height of sprite(mysprite) to 77
  97.     end if
  98. end
  99.  
  100.  
  101. -- move character
  102. on move me, dx, dy
  103.   -- get current loc
  104.   loc = sprite(me.spriteNum).loc
  105.   
  106.   -- move loc and rect
  107.   global pSpeed
  108.   loc = loc + point(dx,dy)*pSpeed
  109.   rect = rect + rect(dx*pSpeed,dy*pSpeed,dx*pSpeed,dy*pSpeed)
  110.   
  111.   -- safety check to make sure character stays on screen
  112.   if rect.left < 0 then exit
  113.   if rect.top < 0 then exit
  114.   if rect.right > (the stage).rect.width then exit
  115.   if rect.bottom > (the stage).rect.height then exit
  116.   
  117.   -- set new character location
  118.   sprite(me.spriteNum).loc = loc
  119. end